#!/bin/sh

echo "U-Boot build menu, please select your choice:"
echo "  1   make distclean"
echo "  2   config for mx28"
echo "  3   build U-Boot"
echo "  q   exit"

#CC=/opt/nxp/gcc-4.3.2-glibc-2.7/bin/arm-vfp-linux-gnu-
CC=arm-fsl-linux-gnueabi-
TFTPBOOT=/tftpboot/

make_distclean() {
    echo "make distclean"
    make ARCH=arm CROSS_COMPILE=$CC distclean
}

config_mx28() {
    make ARCH=arm CROSS_COMPILE=$CC mx28_evk_config
}

build_uboot() {
    make ARCH=arm CROSS_COMPILE=$CC
    cp -av u-boot ../imx-bootlets-src-10.12.01/ 
	sleep 3
	cd ../imx-bootlets-src-10.12.01/
    ./build
    ls
    cd -
    #cp -av  u-boot.bin $TFTPBOOT -fr
}

read sel
echo "select $sel"

case $sel in
    [1]) make_distclean;;
    [2]) config_mx28;;
    [3]) build_uboot;;
    [q]) exit 0;;
    *)   echo "ONLY accept 1/2/3/q/Q"
esac    

